package com.motu.monstercity.module.common.network;

import com.motu.monstercity.protocol.Base.ReqBase;
import io.vertx.core.buffer.Buffer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class DataDecoded {
    private static final Logger logger = LoggerFactory.getLogger(DataDecoded.class);
    public int cmdCode;
    public byte[] pbdata;
    public byte language;//1-简体中文 2-繁体中文 3-英文
    public int reserver1;//保留字段1
    public int messageId;//保留字段2--客户端协议自增id

    public DataDecoded(Buffer data) {
//		logger.info("DataDecoded data len:"+data.length());
        int len = data.getInt(0);
        cmdCode = data.getInt(4);
        byte encrypt = data.getByte(8);
        byte compress = data.getByte(9);
        language = data.getByte(10);
        reserver1 = data.getInt(11);
        messageId = data.getInt(15);
        pbdata = data.getBytes(19, data.length());
//		logger.info("DataDecoded len:"+len+" cmdCode:"+cmdCode+" encrypt:"+encrypt+" compress:"+compress+" language:"+language+" pddata.len:"+pbdata.length);
    }

    public int getCmdCode() {
        return cmdCode;
    }

    public byte[] getReqData() {
        return pbdata;
    }

    public byte getLanguage() {
        return language;
    }

    public int getMessageId() {
        return messageId;
    }
}
